home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / alphaops.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  42.2 KB  |  1,249 lines

  1. /*++
  2.  
  3. Copyright (c) 1992-1996  Digital Equipment Corporation
  4.  
  5. Module Name:
  6.  
  7.     alphaops.h
  8.  
  9. Abstract:
  10.  
  11.     Alpha AXP instruction and floating constant definitions.
  12.  
  13. Author:
  14.  
  15. Revision History:
  16.  
  17. --*/
  18.  
  19. /*
  20.  *      C/C++ Run Time Library - Version 9.0
  21.  *
  22.  *      Copyright (c) 1997, 1998 by Borland International
  23.  *      All Rights Reserved.
  24.  *
  25.  */
  26.  
  27. #ifndef _ALPHAOPS_
  28. #define _ALPHAOPS_
  29. #pragma option push -b
  30.  
  31.  
  32. //
  33. // Instruction types.
  34. //      The Alpha architecture does not number the instruction types,
  35. //      this numbering is for software decoding only.
  36. //
  37.  
  38. #define ALPHA_UNKNOWN           0       // Reserved or illegal
  39. #define ALPHA_MEMORY            1       // Memory (load/store)
  40. #define ALPHA_FP_MEMORY         2       // Floating point Memory
  41. #define ALPHA_MEMSPC            3       // Memory special
  42. #define ALPHA_JUMP              4       // Jump (memory formation)
  43. #define ALPHA_BRANCH            5       // Branch
  44. #define ALPHA_FP_BRANCH         6       // Floating Point Branch
  45. #define ALPHA_OPERATE           7       // Register-register operate
  46. #define ALPHA_LITERAL           8       // Literal-register operate
  47. #define ALPHA_FP_OPERATE        9       // Floating point operate
  48. #define ALPHA_FP_CONVERT        10      // Floating point convert
  49. #define ALPHA_CALLPAL           11      // Call to PAL
  50. #define ALPHA_EV4_PR            12      // EV4 MTPR/MFPR PAL mode instructions
  51. #define ALPHA_EV4_MEM           13      // EV4 special memory PAL mode access
  52. #define ALPHA_EV4_REI           14      // EV4 PAL mode switch
  53.  
  54. //
  55. // Instruction Opcodes.
  56. //
  57.  
  58. #define CALLPAL_OP      0x00    // ALPHA_CALLPAL
  59. #define _01_OP          0x01    // - reserved opcode
  60. #define _02_OP          0x02    // - reserved opcode
  61. #define _03_OP          0x03    // - reserved opcode
  62. #define _04_OP          0x04    // - reserved opcode
  63. #define _05_OP          0x05    // - reserved opcode
  64. #define _06_OP          0x06    // - reserved opcode
  65. #define _07_OP          0x07    // - reserved opcode
  66. #define _0A_OP            0x0A    // - reserved opcode
  67. #define _0C_OP            0x0C    // - reserved opcode
  68. #define _0D_OP            0x0D    // - reserved opcode
  69. #define _0E_OP            0x0E    // - reserved opcode
  70. #define _1C_OP            0x1C    // - reserved opcode
  71. #define LDA_OP          0x08    // ALPHA_MEMORY
  72. #define LDAH_OP         0x09    // ALPHA_MEMORY
  73. #define LDBU_OP         0x0A    // ALPHA_MEMORY
  74. #define LDQ_U_OP        0x0B    // ALPHA_MEMORY
  75. #define LDWU_OP         0x0C    // ALPHA_MEMORY
  76. #define STW_OP          0x0D    // ALPHA_MEMORY
  77. #define STB_OP          0x0E    // ALPHA_MEMORY
  78. #define STQ_U_OP        0x0F    // ALPHA_MEMORY
  79. #define ARITH_OP        0x10    // ALPHA_OPERATE or ALPHA_LITERAL
  80. #define BIT_OP          0x11    // ALPHA_OPERATE or ALPHA_LITERAL
  81. #define BYTE_OP         0x12    // ALPHA_OPERATE or ALPHA_LITERAL
  82. #define MUL_OP          0x13    // ALPHA_OPERATE or ALPHA_LITERAL
  83. #define _14_OP          0x14    // - reserved opcode
  84. #define VAXFP_OP        0x15    // ALPHA_FP_OPERATE
  85. #define IEEEFP_OP       0x16    // ALPHA_FP_OPERATE
  86. #define FPOP_OP         0x17    // ALPHA_FP_OPERATE
  87. #define MEMSPC_OP       0x18    // ALPHA_MEMORY
  88. #define PAL19_OP        0x19    // - reserved for PAL mode
  89. //#define MFPR_OP         0x19    // ALPHA_MFPR
  90. #define JMP_OP          0x1A    // ALPHA_JUMP
  91. #define PAL1B_OP        0x1B    // - reserved for PAL mode
  92. #define SEXT_OP         0x1C    // ALPHA_OPERATE
  93. #define PAL1D_OP        0x1D    // - reserved for PAL mode
  94. //#define MTPR_OP         0x1D    // ALPHA_MTPR
  95. #define PAL1E_OP        0x1E    // - reserved for PAL mode
  96. #define PAL1F_OP        0x1F    // - reserved for PAL mode
  97. #define LDF_OP          0x20    // ALPHA_MEMORY
  98. #define LDG_OP          0x21    // ALPHA_MEMORY
  99. #define LDS_OP          0x22    // ALPHA_MEMORY
  100. #define LDT_OP          0x23    // ALPHA_MEMORY
  101. #define STF_OP          0x24    // ALPHA_MEMORY
  102. #define STG_OP          0x25    // ALPHA_MEMORY
  103. #define STS_OP          0x26    // ALPHA_MEMORY
  104. #define STT_OP          0x27    // ALPHA_MEMORY
  105. #define LDL_OP          0x28    // ALPHA_MEMORY
  106. #define LDQ_OP          0x29    // ALPHA_MEMORY
  107. #define LDL_L_OP        0x2A    // ALPHA_MEMORY
  108. #define LDQ_L_OP        0x2B    // ALPHA_MEMORY
  109. #define STL_OP          0x2C    // ALPHA_MEMORY
  110. #define STQ_OP          0x2D    // ALPHA_MEMORY
  111. #define STL_C_OP        0x2E    // ALPHA_MEMORY
  112. #define STQ_C_OP        0x2F    // ALPHA_MEMORY
  113. #define BR_OP           0x30    // ALPHA_BRANCH
  114. #define FBEQ_OP         0x31    // ALPHA_BRANCH
  115. #define FBLT_OP         0x32    // ALPHA_BRANCH
  116. #define FBLE_OP         0x33    // ALPHA_BRANCH
  117. #define BSR_OP          0x34    // ALPHA_BRANCH
  118. #define FBNE_OP         0x35    // ALPHA_BRANCH
  119. #define FBGE_OP         0x36    // ALPHA_BRANCH
  120. #define FBGT_OP         0x37    // ALPHA_BRANCH
  121. #define BLBC_OP         0x38    // ALPHA_BRANCH
  122. #define BEQ_OP          0x39    // ALPHA_BRANCH
  123. #define BLT_OP          0x3A    // ALPHA_BRANCH
  124. #define BLE_OP          0x3B    // ALPHA_BRANCH
  125. #define BLBS_OP         0x3C    // ALPHA_BRANCH
  126. #define BNE_OP          0x3D    // ALPHA_BRANCH
  127. #define BGE_OP          0x3E    // ALPHA_BRANCH
  128. #define BGT_OP          0x3F    // ALPHA_BRANCH
  129.  
  130. #define LDA_OP_STR      "lda"
  131. #define LDAH_OP_STR     "ldah"
  132. #define LDBU_OP_STR     "ldbu"
  133. #define LDQ_U_OP_STR    "ldq_u"
  134. #define STQ_U_OP_STR    "stq_u"
  135. #define LDF_OP_STR      "ldf"
  136. #define LDG_OP_STR      "ldg"
  137. #define LDS_OP_STR      "lds"
  138. #define LDT_OP_STR      "ldt"
  139. #define LDWU_OP_STR     "ldwu"
  140. #define STF_OP_STR      "stf"
  141. #define STG_OP_STR      "stg"
  142. #define STS_OP_STR      "sts"
  143. #define STT_OP_STR      "stt"
  144. #define LDL_OP_STR      "ldl"
  145. #define LDQ_OP_STR      "ldq"
  146. #define LDL_L_OP_STR    "ldl_l"
  147. #define LDQ_L_OP_STR    "ldq_l"
  148. #define SEXT_OP_STR     "sext"
  149. #define STB_OP_STR      "stb"
  150. #define STL_OP_STR      "stl"
  151. #define STQ_OP_STR      "stq"
  152. #define STL_C_OP_STR    "stl_c"
  153. #define STQ_C_OP_STR    "stq_c"
  154. #define STW_OP_STR      "stw"
  155. #define BR_OP_STR       "br"
  156. #define FBEQ_OP_STR     "fbeq"
  157. #define FBLT_OP_STR     "fblt"
  158. #define FBLE_OP_STR     "fble"
  159. #define BSR_OP_STR      "bsr"
  160. #define FBNE_OP_STR     "fbne"
  161. #define FBGE_OP_STR     "fbge"
  162. #define FBGT_OP_STR     "fbgt"
  163. #define BLBC_OP_STR     "blbc"
  164. #define BEQ_OP_STR      "beq"
  165. #define BLT_OP_STR      "blt"
  166. #define BLE_OP_STR      "ble"
  167. #define BLBS_OP_STR     "blbs"
  168. #define BNE_OP_STR      "bne"
  169. #define BGE_OP_STR      "bge"
  170. #define BGT_OP_STR      "bgt"
  171.  
  172. //
  173. // Type (1) Memory Instruction Format.
  174. // Type (2) Memory Special Instruction Format.
  175. //
  176. //  3         2 2       2 2       1 1
  177. //  1         6 5       1 0       6 5                             0
  178. // +-----------+---------+---------+-------------------------------+
  179. // |   opcode  |   Ra    |   Rb    |          Memory_disp          |
  180. // +-----------+---------+---------+-------------------------------+
  181. //
  182. //      LDAx    Ra.wq,disp.ab(Rb.ab)            x = (,H)
  183. //      LDx     Ra.wq,disp.ab(Rb.ab)            x = (L,Q,F,G,S,T)
  184. //      LDQ_U   Ra.wq,disp.ab(Rb.ab)
  185. //      LDx_L   Ra.wq,disp.ab(Rb.ab)            x = (L,Q)
  186. //      STx_C   Ra.mq,disp.ab(Rb.ab)            x = (L,Q)
  187. //      STx     Ra.rq,disp.ab(Rb.ab)            x = (L,Q,F,G,S,T)
  188. //      STQ_U   Ra.rq,disp.ab(Rb.ab)
  189. //
  190.  
  191. typedef struct _Alpha_Memory_Format {
  192.         LONG MemDisp : 16;
  193.         ULONG Rb : 5;
  194.         ULONG Ra : 5;
  195.         ULONG Opcode : 6;
  196. } Alpha_Memory_Format;
  197.  
  198. //
  199. // Special Memory instruction function codes (in Memdisp).
  200. //
  201.  
  202. #define TRAPB_FUNC        0x0000
  203. #define EXCB_FUNC         0x0400
  204. #define MB_FUNC           0x4000
  205. #define WMB_FUNC          0x4400
  206. #define MB2_FUNC          0x4800
  207. #define MB3_FUNC          0x4C00
  208. #define FETCH_FUNC        0x8000
  209. #define FETCH_M_FUNC      0xA000
  210. #define RPCC_FUNC         0xC000
  211. #define RC_FUNC           0xE000
  212. #define RS_FUNC           0xF000
  213.  
  214. #define TRAPB_FUNC_STR     "trapb"
  215. #define EXCB_FUNC_STR      "excb"
  216. #define MB_FUNC_STR        "mb"
  217. #define MB1_FUNC_STR       "wmb"
  218. #define MB2_FUNC_STR       "mb2"
  219. #define MB3_FUNC_STR       "mb3"
  220. #define FETCH_FUNC_STR     "fetch"
  221. #define FETCH_M_FUNC_STR   "fetch_m"
  222. #define RPCC_FUNC_STR      "rpcc"
  223. #define RC_FUNC_STR        "rc"
  224. #define RS_FUNC_STR        "rs"
  225.  
  226. //
  227. // Type (3) Memory Format Jump Instructions.
  228. //
  229. //  3         2 2       2 2       1 1 1 1
  230. //  1         6 5       1 0       6 5 4 3                         0
  231. // +-----------+---------+---------+---+---------------------------+
  232. // |   opcode  |   Ra    |   Rb    |Fnc|            Hint           |
  233. // +-----------+---------+---------+---+---------------------------+
  234. //
  235. //      xxx     Ra.wq,(Rb.ab),hint      xxx = (JMP, JSR, RET, JSR_COROUTINE)
  236. //
  237.  
  238. typedef struct _Alpha_Jump_Format {
  239.         LONG Hint : 14;
  240.         ULONG Function : 2;
  241.         ULONG Rb : 5;
  242.         ULONG Ra : 5;
  243.         ULONG Opcode : 6;
  244. } Alpha_Jump_Format;
  245.  
  246. //
  247. // Jump function codes (in Function, opcode 1A, JMP_OP).
  248. //
  249.  
  250. #define JMP_FUNC        0x0     // Jump
  251. #define JSR_FUNC        0x1     // Jump to Subroutine
  252. #define RET_FUNC        0x2     // Return from Subroutine
  253. #define JSR_CO_FUNC     0x3     // Jump to Subroutine Return
  254.  
  255. #define JMP_FUNC_STR      "jmp"
  256. #define JSR_FUNC_STR      "jsr"
  257. #define RET_FUNC_STR      "ret"
  258. #define JSR_CO_FUNC_STR   "jsr_cortn"
  259.  
  260. //
  261. // The exception handling compatible return instruction has a hint value
  262. // of 0001. Define a macro that identifies these return instructions.
  263. // The Rb register field is masked out since it is normally, but not
  264. // required to be, RA_REG.
  265. //
  266.  
  267. #define IS_RETURN_0001_INSTRUCTION(Instruction) \
  268.     (((Instruction) & 0xFFE0FFFF) == 0x6BE08001)
  269.  
  270. //
  271. // Type (4) Branch Instruction Format.
  272. //
  273. //  3         2 2       2 2
  274. //  1         6 5       1 0                                       0
  275. // +-----------+---------+-----------------------------------------+
  276. // |   opcode  |   Ra    |             Branch_disp                 |
  277. // +-----------+---------+-----------------------------------------+
  278. //
  279. //      Bxx     Ra.rq,disp.al           x = (EQ,NE,LT,LE,GT,GE,LBC,LBS)
  280. //      BxR     Ra.wq,disp.al           x = (,S)
  281. //      FBxx    Ra.rq,disp.al           x = (EQ,NE,LT,LE,GT,GE)
  282. //
  283.  
  284. typedef struct _Alpha_Branch_Format {
  285.         LONG BranchDisp : 21;
  286.         ULONG Ra : 5;
  287.         ULONG Opcode : 6;
  288. } Alpha_Branch_Format;
  289.  
  290. //
  291. // Type (5) Operate Register Instruction Format.
  292. // Type (6) Operate Literal Instruction Format.
  293. //               bop = Rb.rq or #b.ib
  294. //
  295. //  3         2 2       2 2       1 1   1 1 1
  296. //  1         6 5       1 0       6 5   3 2 1           5 4       0
  297. // +-----------+---------+---------+-----+-+-------------+---------+
  298. // |   opcode  |   Ra    |   Rb    | SBZ |0|  function   |   Rc    |
  299. // +-----------+---------+---------+-----+-+-------------+---------+
  300. //  3         2 2       2 2             1 1 1
  301. //  1         6 5       1 0             3 2 1           5 4       0
  302. // +-----------+---------+---------------+-+-------------+---------+
  303. // |   opcode  |   Ra    |      LIT      |1|  function   |   Rc    |
  304. // +-----------+---------+---------------+-+-------------+---------+
  305. //
  306. //
  307. //      ADDx    Ra.rq,bop,Rc.wq /V      x = (Q,L)
  308. //      SxADDy  Ra.rq,bop,Rc.wq         x = (4,8), y = (Q, L)
  309. //      CMPx    Ra.rq,bop,Rc.wq         x = (EQ,LT,LE,ULT,ULE)
  310. //      MULx    Ra.rq,bop,Rc.wq /V      x = (Q,L)
  311. //      UMULH   Ra.rq,bop,Rc.wq
  312. //      SUBx    Ra.rq,bop,Rc.wq /V      x = (Q,L)
  313. //      SxSUBy  Ra.rq,bop,Rc.wq         x = (4,8), y = (Q, L)
  314. //      xxx     Ra.rq,bop,Rc.wq         xxx = (AND,BIS,XOR,BIC,ORNOT,EQV)
  315. //      CMOVxx  Ra.rq,bop,Rc.wq         xx = (EQ,NE,LT,LE,GT,GE,LBC,LBS)
  316. //      SxL     Ra.rq,bop,Rc.wq         x = (L,R)
  317. //      SRA     Ra.rq,bop,Rc.wq
  318. //      CMPBGE  Ra.rq,bop,Rc.wq
  319. //      EXTxx   Ra.rq,bop,Rc.wq         xx = (BL,WL,WH,LL,LH,WL,QH)
  320. //      INSxx   Ra.rq,bop,Rc.wq         xx = (BL,WL,WH,LL,LH,WL,QH)
  321. //      MSKxx   Ra.rq,bop,Rc.wq         xx = (BL,WL,WH,LL,LH,WL,QH)
  322. //      ZAPx    Ra.rq,bop,Rc.wq         x = (,NOT)
  323. //
  324.  
  325. typedef struct _Alpha_OpReg_Format {
  326.         ULONG Rc : 5;
  327.         ULONG Function : 7;
  328.         ULONG RbvType : 1;              // 0 for register format
  329.         ULONG SBZ : 3;
  330.         ULONG Rb : 5;
  331.         ULONG Ra : 5;
  332.         ULONG Opcode : 6;
  333. } Alpha_OpReg_Format;
  334.  
  335. typedef struct _Alpha_OpLit_Format {
  336.         ULONG Rc : 5;
  337.         ULONG Function : 7;
  338.         ULONG RbvType : 1;              // 1 for literal format
  339.         ULONG Literal : 8;
  340.         ULONG Ra : 5;
  341.         ULONG Opcode : 6;
  342. } Alpha_OpLit_Format;
  343.  
  344. #define RBV_REGISTER_FORMAT 0
  345. #define RBV_LITERAL_FORMAT 1
  346.  
  347. //
  348. // Arithmetic operate function codes (in Function, Opcode 10, ARITH_OP).
  349. //
  350.  
  351. #define ADDL_FUNC       0x00    // Add Longword
  352. #define ADDLV_FUNC      0x40    // Add Longword, Integer Overflow Enable
  353. #define S4ADDL_FUNC     0x02    // Scaled Add Longword by 4
  354. #define S8ADDL_FUNC     0x12    // Scaled Add Longword by 8
  355.  
  356. #define ADDQ_FUNC       0x20    // Add Quadword
  357. #define ADDQV_FUNC      0x60    // Add Quadword, Integer Overflow Enable
  358. #define S4ADDQ_FUNC     0x22    // Scaled Add Quadword by 4
  359. #define S8ADDQ_FUNC     0x32    // Scaled Add Quadword by 8
  360.  
  361. #define SUBL_FUNC       0x09    // Subtract Longword
  362. #define SUBLV_FUNC      0x49    // Subtract Longword, Integer Overflow Enable
  363. #define S4SUBL_FUNC     0x0B    // Scaled Subtract Longword by 4
  364. #define S8SUBL_FUNC     0x1B    // Scaled Subtract Longword by 8
  365.  
  366. #define SUBQ_FUNC       0x29    // Subtract Quadword
  367. #define SUBQV_FUNC      0x69    // Subtract Quadword, Integer Overflow Enable
  368. #define S4SUBQ_FUNC     0x2B    // Scaled Subtract Quadword by 4
  369. #define S8SUBQ_FUNC     0x3B    // Scaled Subtract Quadword by 8
  370.  
  371. #define CMPEQ_FUNC      0x2D    // Compare Signed Quadword Equal
  372. #define CMPLT_FUNC      0x4D    // Compare Signed Quadword Less Than
  373. #define CMPLE_FUNC      0x6D    // Compare Signed Quadword Less Than or Equal
  374. #define CMPULT_FUNC     0x1D    // Compare Unsigned Quadword Less Than
  375. #define CMPULE_FUNC     0x3D    // Compare Unsigned Quadword Less Than or Equal
  376. #define CMPBGE_FUNC     0x0F    // Compare 8 Unsigned Bytes Greater Than or Equal
  377.  
  378. #define ADDL_FUNC_STR     "addl"
  379. #define ADDLV_FUNC_STR    "addl/v"
  380. #define S4ADDL_FUNC_STR   "s4addl"
  381. #define S8ADDL_FUNC_STR   "s8addl"
  382.  
  383. #define ADDQ_FUNC_STR     "addq"
  384. #define ADDQV_FUNC_STR    "addq/v"
  385. #define S4ADDQ_FUNC_STR   "s4addq"
  386. #define S8ADDQ_FUNC_STR   "s8addq"
  387.  
  388. #define SUBL_FUNC_STR     "subl"
  389. #define SUBLV_FUNC_STR    "subl/v"
  390. #define S4SUBL_FUNC_STR   "s4subl"
  391. #define S8SUBL_FUNC_STR   "s8subl"
  392.  
  393. #define SUBQ_FUNC_STR     "subq"
  394. #define SUBQV_FUNC_STR    "subq/v"
  395. #define S4SUBQ_FUNC_STR   "s4subq"
  396. #define S8SUBQ_FUNC_STR   "s8subq"
  397.  
  398. #define CMPEQ_FUNC_STR    "cmpeq"
  399. #define CMPLT_FUNC_STR    "cmplt"
  400. #define CMPLE_FUNC_STR    "cmple"
  401. #define CMPULT_FUNC_STR   "cmpult"
  402. #define CMPULE_FUNC_STR   "cmpule"
  403. #define CMPBGE_FUNC_STR   "cmpbge"
  404.  
  405. //
  406. // Bit and conditional operate function codes (in Function, Opcode 11, BIT_OP).
  407. //
  408.  
  409. #define AND_FUNC        0x00    // Logical Product
  410. #define BIC_FUNC        0x08    // Logical Product with Complement
  411. #define BIS_FUNC        0x20    // Logical Sum (OR)
  412. #define EQV_FUNC        0x48    // Logical Equivalence (XORNOT)
  413. #define ORNOT_FUNC      0x28    // Logical Sum with Complement
  414. #define XOR_FUNC        0x40    // Logical Difference
  415.  
  416. #define CMOVEQ_FUNC     0x24    // CMOVE if Register Equal to Zero
  417. #define CMOVGE_FUNC     0x46    // CMOVE if Register Greater Than or Equal to Zero
  418. #define CMOVGT_FUNC     0x66    // CMOVE if Register Greater Than Zero
  419. #define CMOVLBC_FUNC    0x16    // CMOVE if Register Low Bit Clear
  420. #define CMOVLBS_FUNC    0x14    // CMOVE if Register Low Bit Set
  421. #define CMOVLE_FUNC     0x64    // CMOVE if Register Less Than or Equal to Zero
  422. #define CMOVLT_FUNC     0x44    // CMOVE if Register Less Than Zero
  423. #define CMOVNE_FUNC     0x26    // CMOVE if Register Not Equal to Zero
  424.  
  425. #define AND_FUNC_STR       "and"
  426. #define BIC_FUNC_STR       "bic"
  427. #define BIS_FUNC_STR       "bis"
  428. #define EQV_FUNC_STR       "eqv"
  429. #define ORNOT_FUNC_STR     "ornot"
  430. #define XOR_FUNC_STR       "xor"
  431.  
  432. #define CMOVEQ_FUNC_STR    "cmoveq"
  433. #define CMOVGE_FUNC_STR    "cmovge"
  434. #define CMOVGT_FUNC_STR    "cmovgt"
  435. #define CMOVLBC_FUNC_STR   "cmovlbc"
  436. #define CMOVLBS_FUNC_STR   "cmovlbs"
  437. #define CMOVLE_FUNC_STR    "cmovle"
  438. #define CMOVLT_FUNC_STR    "cmovlt"
  439. #define CMOVNE_FUNC_STR    "cmovne"
  440.  
  441. //
  442. // Shift and byte operate function codes (in Function, Opcode 12, BYTE_OP).
  443. //
  444.  
  445. #define SLL_FUNC        0x39    // Shift Left Logical
  446. #define SRL_FUNC        0x34    // Shift Right Logical
  447. #define SRA_FUNC        0x3C    // Shift Right Arithmetic
  448.  
  449. #define EXTBL_FUNC      0x06    // Extract Byte Low
  450. #define EXTWL_FUNC      0x16    // Extract Word Low
  451. #define EXTLL_FUNC      0x26    // Extract Longword Low
  452. #define EXTQL_FUNC      0x36    // Extract Quadword Low
  453. #define EXTWH_FUNC      0x5A    // Extract Word High
  454. #define EXTLH_FUNC      0x6A    // Extract Longword High
  455. #define EXTQH_FUNC      0x7A    // Extract Quadword High
  456.  
  457. #define INSBL_FUNC      0x0B    // Insert Byte Low
  458. #define INSWL_FUNC      0x1B    // Insert Word Low
  459. #define INSLL_FUNC      0x2B    // Insert Longword Low
  460. #define INSQL_FUNC      0x3B    // Quadword Low
  461. #define INSWH_FUNC      0x57    // Insert Word High
  462. #define INSLH_FUNC      0x67    // Insert Longword High
  463. #define INSQH_FUNC      0x77    // Insert Quadword High
  464.  
  465. #define MSKBL_FUNC      0x02    // Mask Byte Low
  466. #define MSKWL_FUNC      0x12    // Mask Word Low
  467. #define MSKLL_FUNC      0x22    // Mask Longword Low
  468. #define MSKQL_FUNC      0x32    // Mask Quadword Low
  469. #define MSKWH_FUNC      0x52    // Mask Word High
  470. #define MSKLH_FUNC      0x62    // Mask Longword High
  471. #define MSKQH_FUNC      0x72    // Mask Quadword High
  472.  
  473. #define ZAP_FUNC        0x30    // Zero Bytes
  474. #define ZAPNOT_FUNC     0x31    // Zero Bytes Not
  475.  
  476. #define SLL_FUNC_STR    "sll"
  477. #define SRL_FUNC_STR    "srl"
  478. #define SRA_FUNC_STR    "sra"
  479.  
  480. #define EXTBL_FUNC_STR  "extbl"
  481. #define EXTWL_FUNC_STR  "extwl"
  482. #define EXTLL_FUNC_STR  "extll"
  483. #define EXTQL_FUNC_STR  "extql"
  484. #define EXTWH_FUNC_STR  "extwh"
  485. #define EXTLH_FUNC_STR  "extlh"
  486. #define EXTQH_FUNC_STR  "extqh"
  487.  
  488. #define INSBL_FUNC_STR  "insbl"
  489. #define INSWL_FUNC_STR  "inswl"
  490. #define INSLL_FUNC_STR  "insll"
  491. #define INSQL_FUNC_STR  "insql"
  492. #define INSWH_FUNC_STR  "inswh"
  493. #define INSLH_FUNC_STR  "inslh"
  494. #define INSQH_FUNC_STR  "insqh"
  495.  
  496. #define MSKBL_FUNC_STR  "mskbl"
  497. #define MSKWL_FUNC_STR  "mskwl"
  498. #define MSKLL_FUNC_STR  "mskll"
  499. #define MSKQL_FUNC_STR  "mskql"
  500. #define MSKWH_FUNC_STR  "mskwh"
  501. #define MSKLH_FUNC_STR  "msklh"
  502. #define MSKQH_FUNC_STR  "mskqh"
  503.  
  504. #define ZAP_FUNC_STR    "zap"
  505. #define ZAPNOT_FUNC_STR "zapnot"
  506.  
  507. //
  508. // Integer multiply operate function codes (in Function, Opcode 13, MUL_OP).
  509. //
  510.  
  511. #define MULL_FUNC       0x00    // Multiply Longword
  512. #define MULLV_FUNC      0x40    // Multiply Longword, Integer Overflow Enable
  513. #define MULQ_FUNC       0x20    // Multiply Quadword
  514. #define MULQV_FUNC      0x60    // Multiply Quadword, Integer Overflow Enable
  515. #define UMULH_FUNC      0x30    // Unsinged Multiply Quadword High
  516.  
  517. #define MULL_FUNC_STR   "mull"
  518. #define MULLV_FUNC_STR  "mull/v"
  519. #define MULQ_FUNC_STR   "mulq"
  520. #define MULQV_FUNC_STR  "mulq/v"
  521. #define UMULH_FUNC_STR  "umulh"
  522.  
  523. //
  524. // Sign extend operate function codes (in Function, Opcode 1c, SEXT_OP).
  525. //
  526.  
  527. #define SEXTB_FUNC 0
  528. #define SEXTW_FUNC 1
  529.  
  530. #define SEXTB_FUNC_STR      "sextb"
  531. #define SEXTW_FUNC_STR      "sextw"
  532.  
  533. //
  534. // Type (7) Floating-point Operate Instruction Format.
  535. // Type (8) Floating-point Convert Instruction Format.
  536. //
  537. // Type 6 and 7 are the same, except for type 7
  538. //      Fc == F31 (1s) and Fb is the source.
  539. //
  540. //  3         2 2       2 2       1 1
  541. //  1         6 5       1 0       6 5                   5 4       0
  542. // +-----------+---------+---------+---------------------+---------+
  543. // |   opcode  |   Fa    |   Fb    |      function       |   Fc    |
  544. // +-----------+---------+---------+---------------------+---------+
  545. //
  546.  
  547. typedef struct _Alpha_FpOp_Format {
  548.         ULONG Fc : 5;
  549.         ULONG Function : 11;
  550.         ULONG Fb : 5;
  551.         ULONG Fa : 5;
  552.         ULONG Opcode : 6;
  553. } Alpha_FpOp_Format;
  554.  
  555. //
  556. // Format independent function codes (in Function, Opcode 17)
  557. //
  558.  
  559. #define CVTLQ_FUNC      0x010
  560. #define CPYS_FUNC       0x020
  561. #define CPYSN_FUNC      0x021
  562. #define CPYSE_FUNC      0x022
  563. #define MT_FPCR_FUNC    0x024
  564. #define MF_FPCR_FUNC    0x025
  565. #define FCMOVEQ_FUNC    0x02A
  566. #define FCMOVNE_FUNC    0x02B
  567. #define FCMOVLT_FUNC    0x02C
  568. #define FCMOVGE_FUNC    0x02D
  569. #define FCMOVLE_FUNC    0x02E
  570. #define FCMOVGT_FUNC    0x02F
  571. #define CVTQL_FUNC      0x030
  572. #define CVTQLV_FUNC     0x130
  573. #define CVTQLSV_FUNC    0x530
  574.  
  575. #define CVTLQ_FUNC_STR      "cvtlq"
  576. #define CPYS_FUNC_STR       "cpys"
  577. #define CPYSN_FUNC_STR      "cpysn"
  578. #define CPYSE_FUNC_STR      "cpyse"
  579. #define MT_FPCR_FUNC_STR    "mt_fpcr"
  580. #define MF_FPCR_FUNC_STR    "mf_fpcr"
  581. #define FCMOVEQ_FUNC_STR    "fcmoveq"
  582. #define FCMOVNE_FUNC_STR    "fcmovne"
  583. #define FCMOVLT_FUNC_STR    "fcmovlt"
  584. #define FCMOVGE_FUNC_STR    "fcmovge"
  585. #define FCMOVLE_FUNC_STR    "fcmovle"
  586. #define FCMOVGT_FUNC_STR    "fcmovgt"
  587. #define CVTQL_FUNC_STR      "cvtql"
  588. #define CVTQLV_FUNC_STR     "cvtql/v"
  589. #define CVTQLSV_FUNC_STR    "cvtql/sv"
  590.  
  591. //
  592. // IEEE function codes without flags (in Function, Opcode 16).
  593. //
  594.  
  595. #define MSK_FP_OP       0x03F
  596.  
  597. #define ADDS_FUNC       0x000
  598. #define SUBS_FUNC       0x001
  599. #define MULS_FUNC       0x002
  600. #define DIVS_FUNC       0x003
  601. #define ADDT_FUNC       0x020
  602. #define SUBT_FUNC       0x021
  603. #define MULT_FUNC       0x022
  604. #define DIVT_FUNC       0x023
  605. #define CMPTUN_FUNC     0x024
  606. #define CMPTEQ_FUNC     0x025
  607. #define CMPTLT_FUNC     0x026
  608. #define CMPTLE_FUNC     0x027
  609. #define CVTTS_FUNC      0x02C
  610. #define CVTTQ_FUNC      0x02F
  611. #define CVTQS_FUNC      0x03C
  612. #define CVTQT_FUNC      0x03E
  613.  
  614. #define ADDS_FUNC_STR       "adds"
  615. #define SUBS_FUNC_STR       "subs"
  616. #define MULS_FUNC_STR       "muls"
  617. #define DIVS_FUNC_STR       "divs"
  618. #define ADDT_FUNC_STR       "addt"
  619. #define SUBT_FUNC_STR       "subt"
  620. #define MULT_FUNC_STR       "mult"
  621. #define DIVT_FUNC_STR       "divt"
  622. #define CMPTUN_FUNC_STR     "cmptun"
  623. #define CMPTEQ_FUNC_STR     "cmpteq"
  624. #define CMPTLT_FUNC_STR     "cmptlt"
  625. #define CMPTLE_FUNC_STR     "cmptle"
  626. #define CVTTS_FUNC_STR      "cvtts"
  627. #define CVTTQ_FUNC_STR      "cvttq"
  628. #define CVTQS_FUNC_STR      "cvtqs"
  629. #define CVTQT_FUNC_STR      "cvtqt"
  630.  
  631. //
  632. // CVTST is a little different.
  633. //
  634.  
  635. #define CVTST_FUNC      0x2AC
  636. #define CVTST_S_FUNC    0x6AC
  637.  
  638. #define CVTST_FUNC_STR      "cvtst"
  639. #define CVTST_S_FUNC_STR    "cvtst/s"
  640.  
  641. //
  642. // VAX function codes without flags (in Function, Opcode 15).
  643. //
  644.  
  645. #define ADDF_FUNC       0x000
  646. #define CVTDG_FUNC      0x01E
  647. #define ADDG_FUNC       0x020
  648. #define CMPGEQ_FUNC     0x025
  649. #define CMPGLT_FUNC     0x026
  650. #define CMPGLE_FUNC     0x027
  651. #define CVTGF_FUNC      0x02C
  652. #define CVTGD_FUNC      0x02D
  653. #define CVTQF_FUNC      0x03C
  654. #define CVTQG_FUNC      0x03E
  655. #define DIVF_FUNC       0x003
  656. #define DIVG_FUNC       0x023
  657. #define MULF_FUNC       0x002
  658. #define MULG_FUNC       0x022
  659. #define SUBF_FUNC       0x001
  660. #define SUBG_FUNC       0x021
  661. #define CVTGQ_FUNC      0x03F
  662.  
  663. #define ADDF_FUNC_STR       "addf"
  664. #define CVTDG_FUNC_STR      "cvtdg"
  665. #define ADDG_FUNC_STR       "addg"
  666. #define CMPGEQ_FUNC_STR     "cmpgeq"
  667. #define CMPGLT_FUNC_STR     "cmpglt"
  668. #define CMPGLE_FUNC_STR     "cmpgle"
  669. #define CVTGF_FUNC_STR      "cvtgf"
  670. #define CVTGD_FUNC_STR      "cvtgd"
  671. #define CVTQF_FUNC_STR      "cvtqf"
  672. #define CVTQG_FUNC_STR      "cvtqg"
  673. #define DIVF_FUNC_STR       "divf"
  674. #define DIVG_FUNC_STR       "divg"
  675. #define MULF_FUNC_STR       "mulf"
  676. #define MULG_FUNC_STR       "mulg"
  677. #define SUBF_FUNC_STR       "subf"
  678. #define SUBG_FUNC_STR       "subg"
  679. #define CVTGQ_FUNC_STR      "cvtgq"
  680.  
  681. //
  682. // Define subfields within the 11 bit IEEE floating operate function field.
  683. //
  684.  
  685. #define FP_FUNCTION_MASK      0x03F     // Function code including format
  686.  
  687. //
  688. // Define the 2 bit format field.
  689. //
  690.  
  691. #define FP_FORMAT_MASK        0x030
  692. #define FP_FORMAT_S           0x000     // Single (32 bit floating)
  693. #define FP_FORMAT_X           0x010     // Extended (128 bit floating)
  694. #define FP_FORMAT_T           0x020     // Double (64 bit floating)
  695. #define FP_FORMAT_Q           0x030     // Quad (64 bit integer)
  696. #define FP_FORMAT_SHIFT       4
  697.  
  698. //
  699. // Define the 2 bit rounding mode field.
  700. //
  701.  
  702. #define FP_ROUND_MASK         0x0C0
  703. #define FP_ROUND_C            0x000     // Chopped
  704. #define FP_ROUND_M            0x040     // Minus Infinity
  705. #define FP_ROUND_N            0x080     // Nearest
  706. #define FP_ROUND_D            0x0C0     // Dynamic
  707. #define FP_ROUND_SHIFT        6
  708.  
  709. //
  710. // Define the 3 bit trap enable field.
  711. //
  712.  
  713. #define FP_TRAP_ENABLE_MASK   0x700
  714. #define FP_TRAP_ENABLE_NONE   0x000
  715. #define FP_TRAP_ENABLE_U      0x100     // Underflow
  716. #define FP_TRAP_ENABLE_I      0x200     // Inexact
  717.  
  718. #define FP_TRAP_ENABLE_S      0x400     // Software Completion
  719. #define FP_TRAP_ENABLE_SU     0x500
  720. #define FP_TRAP_ENABLE_SUI    0x700
  721.  
  722. #define FP_TRAP_ENABLE_V      0x100     // Integer Overflow
  723. #define FP_TRAP_ENABLE_SV     0x500
  724. #define FP_TRAP_ENABLE_SVI    0x700
  725.  
  726. #define FP_TRAP_ENABLE_SHIFT  8
  727.  
  728. //
  729. // VAX and IEEE function flags (or'd with VAX and IEEE function code)
  730. //
  731.  
  732. #define MSK_FP_FLAGS    0x7C0
  733.  
  734. #define C_FLAGS         0x000
  735. #define M_FLAGS         0x040
  736. #define NONE_FLAGS      0x080
  737. #define D_FLAGS         0x0C0
  738. #define UC_FLAGS        0x100
  739. #define VC_FLAGS        0x100
  740. #define UM_FLAGS        0x140
  741. #define VM_FLAGS        0x140
  742. #define U_FLAGS         0x180
  743. #define V_FLAGS         0x180
  744. #define UD_FLAGS        0x1C0
  745. #define VD_FLAGS        0x1C0
  746. #define SC_FLAGS        0x400
  747. #define S_FLAGS         0x480
  748. #define SUC_FLAGS       0x500
  749. #define SVC_FLAGS       0x500
  750. #define SUM_FLAGS       0x540
  751. #define SVM_FLAGS       0x540
  752. #define SU_FLAGS        0x580
  753. #define SV_FLAGS        0x580
  754. #define SUD_FLAGS       0x5C0
  755. #define SVD_FLAGS       0x5C0
  756. #define SUIC_FLAGS      0x700
  757. #define SVIC_FLAGS      0x700
  758. #define SUIM_FLAGS      0x740
  759. #define SVIM_FLAGS      0x740
  760. #define SUI_FLAGS       0x780
  761. #define SVI_FLAGS       0x780
  762. #define SUID_FLAGS      0x7C0
  763. #define SVID_FLAGS      0x7C0
  764.  
  765. #define C_FLAGS_STR       "/c"
  766. #define M_FLAGS_STR       "/m"
  767. #define NONE_FLAGS_STR    ""
  768. #define D_FLAGS_STR       "/d"
  769. #define UC_FLAGS_STR      "/uc"
  770. #define VC_FLAGS_STR      "/vc"
  771. #define UM_FLAGS_STR      "/um"
  772. #define VM_FLAGS_STR      "/vm"
  773. #define U_FLAGS_STR       "/u"
  774. #define V_FLAGS_STR       "/v"
  775. #define UD_FLAGS_STR      "/ud"
  776. #define VD_FLAGS_STR      "/vd"
  777. #define SC_FLAGS_STR      "/sc"
  778. #define S_FLAGS_STR       "/s"
  779. #define SUC_FLAGS_STR     "/suc"
  780. #define SVC_FLAGS_STR     "/svc"
  781. #define SUM_FLAGS_STR     "/sum"
  782. #define SVM_FLAGS_STR     "/svm"
  783. #define SU_FLAGS_STR      "/su"
  784. #define SV_FLAGS_STR      "/sv"
  785. #define SUD_FLAGS_STR     "/sud"
  786. #define SVD_FLAGS_STR     "/svd"
  787. #define SUIC_FLAGS_STR    "/suic"
  788. #define SVIC_FLAGS_STR    "/svic"
  789. #define SUIM_FLAGS_STR    "/suim"
  790. #define SVIM_FLAGS_STR    "/svim"
  791. #define SUI_FLAGS_STR     "/sui"
  792. #define SVI_FLAGS_STR     "/svi"
  793. #define SUID_FLAGS_STR    "/suid"
  794. #define SVID_FLAGS_STR    "/svid"
  795.  
  796. //
  797. // Type (9) PALcode Instruction Format.
  798. //
  799. //  3         2 2
  800. //  1         6 5                                                 0
  801. // +-----------+---------------------------------------------------+
  802. // |   opcode  |                  PALcode func                     |
  803. // +-----------+---------------------------------------------------+
  804. //
  805.  
  806. typedef struct _Alpha_PAL_Format {
  807.         ULONG Function : 26;
  808.         ULONG Opcode : 6;
  809. } Alpha_PAL_Format;
  810.  
  811. //
  812. // Call to PAL function codes (in Function, Opcode 0, CALLPAL_OP).
  813. //
  814. // N.B. - if new call pal functions are added, they must also be added
  815. // in genalpha.c, genalpha.c will generate the include file for .s files
  816. // that will define the call pal mnemonics for assembly language use
  817. //
  818.  
  819. #define PRIV_PAL_FUNC 0x0
  820. #define UNPRIV_PAL_FUNC 0x80
  821.  
  822.  
  823. //
  824. // Unprivileged call pal functions.
  825. //
  826.  
  827. #define BPT_FUNC       (UNPRIV_PAL_FUNC | 0x00)
  828. #define CALLSYS_FUNC   (UNPRIV_PAL_FUNC | 0x03)
  829. #define IMB_FUNC       (UNPRIV_PAL_FUNC | 0x06)
  830. #define GENTRAP_FUNC   (UNPRIV_PAL_FUNC | 0xAA)
  831. #define RDTEB_FUNC     (UNPRIV_PAL_FUNC | 0xAB)
  832. #define KBPT_FUNC      (UNPRIV_PAL_FUNC | 0xAC)
  833. #define CALLKD_FUNC    (UNPRIV_PAL_FUNC | 0xAD)
  834.  
  835. #define BPT_FUNC_STR       "bpt"
  836. #define CALLSYS_FUNC_STR   "callsys"
  837. #define IMB_FUNC_STR       "imb"
  838. #define RDTEB_FUNC_STR     "rdteb"
  839. #define GENTRAP_FUNC_STR   "gentrap"
  840. #define KBPT_FUNC_STR      "kbpt"
  841. #define CALLKD_FUNC_STR    "callkd"
  842.  
  843. //
  844. // Priveleged call pal functions.
  845. //
  846.  
  847. #define HALT_FUNC       (PRIV_PAL_FUNC | 0x00)
  848. #define RESTART_FUNC    (PRIV_PAL_FUNC | 0x01)
  849. #define DRAINA_FUNC     (PRIV_PAL_FUNC | 0x02)
  850. #define REBOOT_FUNC     (PRIV_PAL_FUNC | 0x03)
  851. #define INITPAL_FUNC    (PRIV_PAL_FUNC | 0x04)
  852. #define WRENTRY_FUNC    (PRIV_PAL_FUNC | 0x05)
  853. #define SWPIRQL_FUNC    (PRIV_PAL_FUNC | 0x06)
  854. #define RDIRQL_FUNC     (PRIV_PAL_FUNC | 0x07)
  855. #define DI_FUNC         (PRIV_PAL_FUNC | 0X08)
  856. #define EI_FUNC         (PRIV_PAL_FUNC | 0x09)
  857. #define SWPPAL_FUNC     (PRIV_PAL_FUNC | 0x0A)
  858. #define SSIR_FUNC       (PRIV_PAL_FUNC | 0x0C)
  859. #define CSIR_FUNC       (PRIV_PAL_FUNC | 0x0D)
  860. #define RFE_FUNC        (PRIV_PAL_FUNC | 0x0E)
  861. #define RETSYS_FUNC     (PRIV_PAL_FUNC | 0x0F)
  862. #define SWPCTX_FUNC     (PRIV_PAL_FUNC | 0x10)
  863. #define SWPPROCESS_FUNC (PRIV_PAL_FUNC | 0x11)
  864. #define RDMCES_FUNC     (PRIV_PAL_FUNC | 0x12)
  865. #define WRMCES_FUNC     (PRIV_PAL_FUNC | 0x13)
  866. #define TBIA_FUNC       (PRIV_PAL_FUNC | 0x14)
  867. #define TBIS_FUNC       (PRIV_PAL_FUNC | 0x15)
  868. #define DTBIS_FUNC      (PRIV_PAL_FUNC | 0x16)
  869. #define TBISASN_FUNC    (PRIV_PAL_FUNC | 0x17)
  870. #define RDKSP_FUNC      (PRIV_PAL_FUNC | 0x18)
  871. #define SWPKSP_FUNC     (PRIV_PAL_FUNC | 0x19)
  872. #define RDPSR_FUNC      (PRIV_PAL_FUNC | 0x1A)
  873. #define RDPCR_FUNC      (PRIV_PAL_FUNC | 0x1C)
  874. #define RDTHREAD_FUNC   (PRIV_PAL_FUNC | 0x1E)
  875. #define TBIM_FUNC       (PRIV_PAL_FUNC | 0x20)
  876. #define TBIMASN_FUNC    (PRIV_PAL_FUNC | 0x21)
  877. #define RDCOUNTERS_FUNC (PRIV_PAL_FUNC | 0x30)
  878. #define RDSTATE_FUNC    (PRIV_PAL_FUNC | 0x31)
  879. #define WRPERFMON_FUNC  (PRIV_PAL_FUNC | 0x32)
  880.  
  881. #define HALT_FUNC_STR       "halt"
  882. #define RESTART_FUNC_STR    "restart"
  883. #define DRAINA_FUNC_STR     "draina"
  884. #define REBOOT_FUNC_STR     "reboot"
  885. #define INITPAL_FUNC_STR    "initpal"
  886. #define WRENTRY_FUNC_STR    "wrentry"
  887. #define SWPIRQL_FUNC_STR    "swpirql"
  888. #define RDIRQL_FUNC_STR     "rdirql"
  889. #define DI_FUNC_STR         "di"
  890. #define EI_FUNC_STR         "ei"
  891. #define SWPPAL_FUNC_STR     "swppal"
  892. #define SSIR_FUNC_STR       "ssir"
  893. #define CSIR_FUNC_STR       "csir"
  894. #define RFE_FUNC_STR        "rfe"
  895. #define RETSYS_FUNC_STR     "retsys"
  896. #define SWPCTX_FUNC_STR     "swpctx"
  897. #define SWPPROCESS_FUNC_STR "swpprocess"
  898. #define RDMCES_FUNC_STR     "rdmces"
  899. #define WRMCES_FUNC_STR     "wrmces"
  900. #define TBIA_FUNC_STR       "tbia"
  901. #define TBIS_FUNC_STR       "tbis"
  902. #define DTBIS_FUNC_STR      "dtbis"
  903. #define TBISASN_FUNC_STR    "tbisasn"
  904. #define RDKSP_FUNC_STR      "rdksp"
  905. #define SWPKSP_FUNC_STR     "swpksp"
  906. #define RDPSR_FUNC_STR      "rdpsr"
  907. #define RDPCR_FUNC_STR      "rdpcr"
  908. #define RDTHREAD_FUNC_STR   "rdthread"
  909. #define TBIM_FUNC_STR       "tbim"
  910. #define TBIMASN_FUNC_STR    "tbimasn"
  911. #define RDCOUNTERS_FUNC_STR "rdcounters"
  912. #define RDSTATE_FUNC_STR    "rdstate"
  913. #define WRPERFMON_FUNC_STR "wrperfmon"
  914.  
  915. //
  916. // 21064 (ev4) - specific call pal functions.
  917. //
  918.  
  919. #define INITPCR_FUNC    (PRIV_PAL_FUNC | 0x38)
  920.  
  921. #define INITPCR_FUNC_STR   "initpcr"
  922.  
  923. //
  924. // Type (10) EV4 MTPR/MFPR PAL mode instructions.
  925. //
  926. //  3         2 2       2 2       1 1
  927. //  1         6 5       1 0       6 5             8 7 6 5 4       0
  928. // +-----------+---------+---------+---------------+-+-+-+---------+
  929. // |   opcode  |   Ra    |   Rb    |      IGN      |P|A|I|  Index  |
  930. // +-----------+---------+---------+---------------+-+-+-+---------+
  931. //
  932.  
  933. typedef struct _Alpha_EV4_PR_Format {
  934.         ULONG Index : 5;
  935.         ULONG Ibox : 1;
  936.         ULONG Abox : 1;
  937.         ULONG PalTemp : 1;
  938.         ULONG IGN : 8;
  939.         ULONG Rb : 5;
  940.         ULONG Ra : 5;
  941.         ULONG Opcode : 6;
  942. } Alpha_EV4_PR_Format;
  943.  
  944. //
  945. // Type (10) EV5 MTPR/MFPR PAL mode instructions.
  946. //
  947. //  3         2 2       2 2       1 1
  948. //  1         6 5       1 0       6 5                              0
  949. // +-----------+---------+---------+-------------------------------+
  950. // |   opcode  |   Ra    |   Rb    |            Index              |
  951. // +-----------+---------+---------+-------------------------------+
  952. //
  953.  
  954. typedef struct _Alpha_EV5_PR_Format {
  955.         ULONG Index : 16;
  956.         ULONG Rb : 5;
  957.         ULONG Ra : 5;
  958.         ULONG Opcode : 6;
  959. } Alpha_EV5_PR_Format;
  960.  
  961. #define MTPR_OP       0x1D
  962. #define MFPR_OP       0x19
  963.  
  964. #define MTPR_OP_STR   "mt"
  965. #define MFPR_OP_STR   "mf"
  966.  
  967. //
  968. // Type (11) EV4 special memory PAL mode access.
  969. //
  970. //  3         2 2       2 2       1 1 1 1 1 1
  971. //  1         6 5       1 0       6 5 4 3 2 1                     0
  972. // +-----------+---------+---------+-+-+-+-+-----------------------+
  973. // |   opcode  |   Ra    |   Rb    |P|A|R|Q|         Disp          |
  974. // +-----------+---------+---------+-+-+-+-+-----------------------+
  975. //
  976.  
  977. typedef struct _Alpha_EV4_MEM_Format {
  978.         ULONG Disp : 12;
  979.         ULONG QuadWord : 1;
  980.         ULONG RWcheck : 1;
  981.         ULONG Alt : 1;
  982.         ULONG Physical : 1;
  983.         ULONG Rb : 5;
  984.         ULONG Ra : 5;
  985.         ULONG Opcode : 6;
  986. } Alpha_EV4_MEM_Format;
  987.  
  988. //
  989. // Type (11) EV5 special memory PAL mode access.
  990. //
  991. //  3         2 2       2 2       1 1 1 1 1 1
  992. //  1         6 5       1 0       6 5 4 3 2 1                     0
  993. // +-----------+---------+---------+-+-+-+-+-----------------------+
  994. // |   opcode  |   Ra    |   Rb    |P|A|R|Q|         Disp          |
  995. // +-----------+---------+---------+-+-+-+-+-----------------------+
  996. //
  997.  
  998. typedef struct _Alpha_EV5_MEM_Format {
  999.         ULONG Disp : 10;
  1000.         ULONG Lock_Cond: 1;
  1001.         ULONG Vpte: 1;
  1002.         ULONG QuadWord : 1;
  1003.         ULONG RWcheck : 1;
  1004.         ULONG Alt : 1;
  1005.         ULONG Physical : 1;
  1006.         ULONG Rb : 5;
  1007.         ULONG Ra : 5;
  1008.         ULONG Opcode : 6;
  1009. } Alpha_EV5_MEM_Format;
  1010.  
  1011. #define HWLD_OP      0x1B
  1012. #define HWST_OP      0x1F
  1013.  
  1014. #define HWLD_OP_STR  "hwld"
  1015. #define HWST_OP_STR  "hwst"
  1016.  
  1017. // Type (12) EV4 PAL mode switch.
  1018. //
  1019. //  3         2 2       2 2       1 1 1 1
  1020. //  1         6 5       1 0       6 5 4 3                         0
  1021. // +-----------+---------+---------+-+-+---------------------------+
  1022. // |   opcode  |   Ra    |   Rb    |1|0|          IGN              |
  1023. // +-----------+---------+---------+-+-+---------------------------+
  1024.  
  1025. typedef struct _Alpha_EV4_REI_Format {
  1026.         ULONG IGN : 14;
  1027.         ULONG zero : 1;
  1028.         ULONG one : 1;
  1029.         ULONG Rb : 5;
  1030.         ULONG Ra : 5;
  1031.         ULONG Opcode : 6;
  1032. } Alpha_EV4_REI_Format;
  1033.  
  1034. // Type (12) EV5 PAL mode switch.
  1035. //
  1036. //  3         2 2       2 2       1 1 1 1
  1037. //  1         6 5       1 0       6 5 4 3                         0
  1038. // +-----------+---------+---------+-+-+---------------------------+
  1039. // |   opcode  |   Ra    |   Rb    |1|0|          IGN              |
  1040. // +-----------+---------+---------+-+-+---------------------------+
  1041.  
  1042. typedef struct _Alpha_EV5_REI_Format {
  1043.         ULONG IGN : 14;
  1044.         ULONG Type: 2;
  1045.         ULONG Rb : 5;
  1046.         ULONG Ra : 5;
  1047.         ULONG Opcode : 6;
  1048. } Alpha_EV5_REI_Format;
  1049.  
  1050. #define REI_OP    0x1E
  1051.  
  1052. #define REI_OP_STR  "rei"
  1053.  
  1054. //
  1055. //
  1056. //
  1057. typedef union _Alpha_Instruction {
  1058.         ULONG Long;
  1059.         UCHAR Byte[4];
  1060.  
  1061.         Alpha_Memory_Format Memory;
  1062.         Alpha_Jump_Format Jump;
  1063.         Alpha_Branch_Format Branch;
  1064.         Alpha_OpReg_Format OpReg;
  1065.         Alpha_OpLit_Format OpLit;
  1066.         Alpha_FpOp_Format FpOp;
  1067.         Alpha_PAL_Format Pal;
  1068.         Alpha_EV4_PR_Format EV4_PR;
  1069.         Alpha_EV4_MEM_Format EV4_MEM;
  1070.         Alpha_EV4_REI_Format EV4_REI;
  1071.         Alpha_EV5_PR_Format EV5_PR;
  1072.         Alpha_EV5_MEM_Format EV5_MEM;
  1073.         Alpha_EV5_REI_Format EV5_REI;
  1074. } ALPHA_INSTRUCTION, *PALPHA_INSTRUCTION;
  1075.  
  1076. //
  1077. // Define standard integer register assignments.
  1078. //
  1079.  
  1080. #define V0_REG      0       // v0 - return value register
  1081.  
  1082. #define T0_REG      1       // t0 - temporary register
  1083. #define T1_REG      2       // t1 - temporary register
  1084. #define T2_REG      3       // t2 - temporary register
  1085. #define T3_REG      4       // t3 - temporary register
  1086. #define T4_REG      5       // t4 - temporary register
  1087. #define T5_REG      6       // t5 - temporary register
  1088. #define T6_REG      7       // t6 - temporary register
  1089. #define T7_REG      8       // t7 - temporary register
  1090.  
  1091. #define S0_REG      9       // s0 - saved register
  1092. #define S1_REG      10      // s1 - saved register
  1093. #define S2_REG      11      // s2 - saved register
  1094. #define S3_REG      12      // s3 - saved register
  1095. #define S4_REG      13      // s4 - saved register
  1096. #define S5_REG      14      // s5 - saved register
  1097.  
  1098. #define S6_REG      15      // s6 - saved register, aka fp
  1099. #define FP_REG      15      // fp - frame pointer register
  1100.  
  1101. #define A0_REG      16      // a0 - argument register
  1102. #define A1_REG      17      // a1 - argument register
  1103. #define A2_REG      18      // a2 - argument register
  1104. #define A3_REG      19      // a3 - argument register
  1105. #define A4_REG      20      // a4 - argument register
  1106. #define A5_REG      21      // a5 - argument register
  1107.  
  1108. #define T8_REG      22      // t8 - temporary register
  1109. #define T9_REG      23      // t9 - temporary register
  1110. #define T10_REG     24      // t10 - temporary register
  1111. #define T11_REG     25      // t11 - temporary register
  1112.  
  1113. #define RA_REG      26      // ra - return address register
  1114. #define T12_REG     27      // t12 - temporary register
  1115. #define AT_REG      28      // at - assembler temporary register
  1116. #define GP_REG      29      // gp - global pointer register
  1117. #define SP_REG      30      // sp - stack pointer register
  1118. #define ZERO_REG    31      // zero - zero register
  1119.  
  1120. //
  1121. // Define standard floating point register assignments.
  1122. //
  1123.  
  1124. #define F0_REG      0       // floating return value register (real)
  1125. #define F1_REG      1       // floating return value register (imaginary)
  1126. #define F16_REG     16      // floating argument register
  1127. #define FZERO_REG   31      // floating zero register
  1128.  
  1129. //
  1130. //  Define standard integer register strings
  1131. //
  1132.  
  1133. #define V0_REG_STR      "v0"     // - return value register
  1134.  
  1135. #define T0_REG_STR      "t0"     // - temporary register
  1136. #define T1_REG_STR      "t1"     // - temporary register
  1137. #define T2_REG_STR      "t2"     // - temporary register
  1138. #define T3_REG_STR      "t3"     // - temporary register
  1139. #define T4_REG_STR      "t4"     // - temporary register
  1140. #define T5_REG_STR      "t5"     // - temporary register
  1141. #define T6_REG_STR      "t6"     // - temporary register
  1142. #define T7_REG_STR      "t7"     // - temporary register
  1143.  
  1144. #define S0_REG_STR      "s0"     // - saved register
  1145. #define S1_REG_STR      "s1"     // - saved register
  1146. #define S2_REG_STR      "s2"     // - saved register
  1147. #define S3_REG_STR      "s3"     // - saved register
  1148. #define S4_REG_STR      "s4"     // - saved register
  1149. #define S5_REG_STR      "s5"     // - saved register
  1150.  
  1151. #define S6_REG_STR      "s6"     // - saved register, aka fp
  1152. #define FP_REG_STR      "fp"     // - frame pointer register
  1153.  
  1154. #define A0_REG_STR      "a0"     // - argument register
  1155. #define A1_REG_STR      "a1"     // - argument register
  1156. #define A2_REG_STR      "a2"     // - argument register
  1157. #define A3_REG_STR      "a3"     // - argument register
  1158. #define A4_REG_STR      "a4"     // - argument register
  1159. #define A5_REG_STR      "a5"     // - argument register
  1160.  
  1161. #define T8_REG_STR      "t8"     // - temporary register
  1162. #define T9_REG_STR      "t9"     // - temporary register
  1163. #define T10_REG_STR     "t10"    // - temporary register
  1164. #define T11_REG_STR     "t11"    // - temporary register
  1165.  
  1166. #define RA_REG_STR      "ra"     // - return address register
  1167. #define T12_REG_STR     "t12"    // - temporary register
  1168. #define AT_REG_STR      "at"     // - assembler temporary register
  1169. #define GP_REG_STR      "gp"     // - global pointer register
  1170. #define SP_REG_STR      "sp"     // - stack pointer register
  1171. #define ZERO_REG_STR    "zero"   // - zero register
  1172.  
  1173. //
  1174. // Define maximum and minimum single and double exponent values.
  1175. //
  1176.  
  1177. #define DOUBLE_MAXIMUM_EXPONENT 2047
  1178. #define DOUBLE_MINIMUM_EXPONENT 0
  1179.  
  1180. #define SINGLE_MAXIMUM_EXPONENT 255
  1181. #define SINGLE_MINIMUM_EXPONENT 0
  1182.  
  1183. //
  1184. // Define single and double exponent bias values.
  1185. //
  1186.  
  1187. #define SINGLE_EXPONENT_BIAS 127
  1188. #define DOUBLE_EXPONENT_BIAS 1023
  1189.  
  1190. //
  1191. // Define the largest single and double values.
  1192. //
  1193.  
  1194. #define SINGLE_MAXIMUM_VALUE 0x7f7fffff
  1195.  
  1196. #define DOUBLE_MAXIMUM_VALUE_HIGH 0x7fefffff
  1197. #define DOUBLE_MAXIMUM_VALUE_LOW 0xffffffff
  1198.  
  1199. //
  1200. // Define single and double quiet and signaling Nan values
  1201. // (these are identical to X86 formats; Mips is different).
  1202. //
  1203.  
  1204. #define SINGLE_QUIET_NAN_PREFIX 0x7fc00000
  1205. #define SINGLE_SIGNAL_NAN_PREFIX 0x7f800000
  1206. #define SINGLE_QUIET_NAN_VALUE 0xffc00000
  1207.  
  1208. #define DOUBLE_QUIET_NAN_PREFIX_HIGH 0x7ff80000
  1209. #define DOUBLE_SIGNAL_NAN_PREFIX_HIGH 0x7ff00000
  1210. #define DOUBLE_QUIET_NAN_VALUE_HIGH 0xfff80000
  1211. #define DOUBLE_QUIET_NAN_VALUE_LOW 0x0
  1212.  
  1213. //
  1214. // Define positive single and double infinity values.
  1215. //
  1216.  
  1217. #define SINGLE_INFINITY_VALUE 0x7f800000
  1218.  
  1219. #define DOUBLE_INFINITY_VALUE_HIGH 0x7ff00000
  1220. #define DOUBLE_INFINITY_VALUE_LOW 0x0
  1221.  
  1222. //
  1223. // Quadword versions of the above.
  1224. //
  1225.  
  1226. #define DOUBLE_MAXIMUM_VALUE        ((ULONGLONG)0x7fefffffffffffff)
  1227. #define DOUBLE_INFINITY_VALUE       ((ULONGLONG)0x7ff0000000000000)
  1228. #define DOUBLE_QUIET_NAN_VALUE      ((ULONGLONG)0xfff8000000000000)
  1229.  
  1230. //
  1231. // Define result values for IEEE floating point comparison operations.
  1232. // True is 2.0 and False is 0.0.
  1233. //
  1234.  
  1235. #define FP_COMPARE_TRUE             ((ULONGLONG)0x4000000000000000)
  1236. #define FP_COMPARE_FALSE            ((ULONGLONG)0x0000000000000000)
  1237.  
  1238. //
  1239. // Define Alpha AXP rounding modes.
  1240. //
  1241.  
  1242. #define ROUND_TO_ZERO 0                 // round toward zero
  1243. #define ROUND_TO_MINUS_INFINITY 1       // round toward minus infinity
  1244. #define ROUND_TO_NEAREST 2              // round to nearest representable value
  1245. #define ROUND_TO_PLUS_INFINITY 3        // round toward plus infinity
  1246.  
  1247. #pragma option pop
  1248. #endif // _ALPHAOPS_
  1249.